package com.tongzhan.controller;

import com.tongzhan.base.Return;
import com.tongzhan.entity.qiaotai.BasicDemo;
import com.tongzhan.entity.qiaotai.OpinionCar;
import com.tongzhan.entity.xiangxian.ExamplePoint;
import com.tongzhan.entity.xiangxian.Fengcai;
import com.tongzhan.service.QiaotaiService;
import com.tongzhan.service.XiangxianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 侨台
 */
@RequestMapping("/qiaotai")
@RestController
public class QiaotaiController {

    @Autowired
    private QiaotaiService qiaotaiService;

    /**
     * 获取侨台大屏地图列表
     * @return
     */
    @RequestMapping("/getMapList")
    public Return getMapList(Integer type,String date) {
        Map<String, Object> map = new HashMap<>();
        List<BasicDemo> list = qiaotaiService.getMapList(type,date);
        map.put("list",list);
        return Return.getSuccessResult(map);
    }

    /**
     * 获取侨台民意直通车列表
     * @return
     */
    @RequestMapping("/getOpinionCarList")
    public Return getOpinionCarList(Integer type,String date) {
        Map<String, Object> map = new HashMap<>();
        List<OpinionCar> list = qiaotaiService.getOpinionCarList(type,date);
        map.put("list",list);
        return Return.getSuccessResult(map);
    }

    /**
     * 获取侨台基础信息统计
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/getUserInfoList")
    public Return getUserInfoList(Integer type,String date) {
        Map<String, Object> map = qiaotaiService.getUserInfoList(type,date);
        return Return.getSuccessResult(map);
    }

    /**
     * 获取侨台人员信息列表
     * @param type
     * @param date
     * @param name
     * @param typeId
     * @return
     */
    @RequestMapping("/getPersonnelList")
    public Return getPersonnelList(Integer type,String date,String name,Integer typeId) {
        Map<String, Object> map = qiaotaiService.getPersonnelList(type,date,name,typeId);
        return Return.getSuccessResult(map);
    }


    /**
     * 获取侨台活动中心统计
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/getActionCenterList")
    public Return getActionCenterList(Integer type,String date) {
        Map<String, Object> map = qiaotaiService.getActionCenterList(type,date);
        return Return.getSuccessResult(map);
    }

    /**
     * 获取侨台参政议政统计
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/getPeopleOpinionCount")
    public Return getPeopleOpinionCount(Integer type,String date) {
        Map<String, Object> map = qiaotaiService.getPeopleOpinionCount(type,date);
        return Return.getSuccessResult(map);
    }

    /**
     * 人员统计
     * @return
     */
    @GetMapping("/personCount")
    public Return personCount(@RequestParam(value = "streetCode",required = false) String streetCode,@RequestParam(value = "villageCode",required = false) String villageCode) {
        return Return.getSuccessResult(qiaotaiService.personCount(streetCode,villageCode));
    }

    /**
     * 活动中心统计
     * @return
     */
    @GetMapping("/actionCenterCount")
    public Return actionCenterCount(@RequestParam(value = "streetCode",required = false) String streetCode,@RequestParam(value = "villageCode",required = false) String villageCode){
        return Return.getSuccessResult(qiaotaiService.actionCenterCount(streetCode,villageCode));
    }

    /**
     * 活动中心统计详情
     * @return
     */
    @GetMapping("/actionCenterDetail")
    public Return actionCenterDetail(@RequestParam(value = "streetCode",required = false) String streetCode,@RequestParam(value = "villageCode",required = false) String villageCode){
        return Return.getSuccessResult(qiaotaiService.actionCenterDetail(streetCode,villageCode));
    }


    /**
     * 侨资企业统计
     * @return
     */
    @GetMapping("/companyCount")
    public Return companyCount(@RequestParam(value = "streetCode",required = false) String streetCode,@RequestParam(value = "villageCode",required = false) String villageCode){
        return Return.getSuccessResult(qiaotaiService.companyCount(streetCode,villageCode));
    }

    /**
     * 侨资企业统计详情
     * @return
     */
    @GetMapping("/companyDetail")
    public Return companyDetail(@RequestParam(value = "streetCode",required = false) String streetCode,@RequestParam(value = "villageCode",required = false) String villageCode){
        return Return.getSuccessResult(qiaotaiService.companyDetail(streetCode,villageCode));
    }

    /**
     * 民意直通车统计
     * @return
     */
    @GetMapping("/opinionCarCount")
    public Return opinionCarCount(@RequestParam(value = "streetCode",required = false) String streetCode,@RequestParam(value = "villageCode",required = false) String villageCode){
        return Return.getSuccessResult(qiaotaiService.opinionCarCount(streetCode,villageCode));
    }

    /**
     * 民意直通车统计详情
     * @return
     */
    @GetMapping("/opinionCarDetail")
    public Return opinionCarDetail(@RequestParam(value = "streetCode",required = false) String streetCode,@RequestParam(value = "villageCode",required = false) String villageCode){
        return Return.getSuccessResult(qiaotaiService.opinionCarDetail(streetCode,villageCode));
    }

    /**
     * 获取侨胞之家地图数据
     * @return
     */
    @GetMapping("/brandMapList")
    public Return brandMapList(Integer type){
        return Return.getSuccessResult(qiaotaiService.brandMapList(type));
    }
}
